
#include "Arp2.h"
#include "Ping.h"
#include <iostream>
#include "TraceRoute.h"
#include "TraceASRoute.h"
#include "TraceGeoRoute.h"

int main(int argc, char** argv)
{
    if (getuid() != 0)
    {
		std::cout << "The application requires root priviledges" << std::endl;
		exit(EXIT_FAILURE);
    }

	if(argc == 1)
	{
		std::cout << "Usage: " << argv[0] << " -r hostToArp" << std::endl;
		std::cout << "Usage: " << argv[0] << " -p hostToPing" << std::endl;
		std::cout << "Usage: " << argv[0] << " -t hostToTrace" << std::endl;
		std::cout << "Usage: " << argv[0] << " -a hostToASTrace" << std::endl;
		std::cout << "Usage: " << argv[0] << " -g hostToGeoTrace" << std::endl;
		return -1;
	}

	if((argv[1][0] == '-') && (argv[1][1] == 'r') && (argc == 3))
	{
		return Arp(argv[2]);
	}
	else if((argv[1][0] == '-') && (argv[1][1] == 'p') && (argc == 3))
	{
		return Ping(argv[2]);
	}
	else if((argv[1][0] == '-') && (argv[1][1] == 't') && (argc == 3))
	{
		return TraceRoute(argv[2]);
	}
	else if((argv[1][0] == '-') && (argv[1][1] == 'a') && (argc == 3))
	{
		return TraceASRoute(argv[2]);
	}
	else if((argv[1][0] == '-') && (argv[1][1] == 'g') && (argc == 3))
	{
		return TraceGeoRoute(argv[2]);
	}

	return -1;
}
